home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d13 / port11.arc / PORT.DOC < prev    next >
Text File  |  1991-10-07  |  12KB  |  359 lines

  1.  
  2.                                      PORT
  3.  
  4.                             The Port Twiddling Tool
  5.  
  6.                        By John De Armond (jgd@dixie.com)
  7.                          Rapid Deployment Systems, Inc.
  8.  
  9. Introduction
  10.  
  11. PORT is a tool written to facilitate working with I/O ports on the PC or
  12. Intel processor-based hardware.  It has many uses.  Among them:
  13.  
  14.     *    Debugging new hardware.
  15.     *    Reverse engineering old hardware.
  16.     *    Finding out where an adaptor card decodes its ports.
  17.     *    Otherwise manipulating I/O ports.
  18.  
  19. Among the capabilities:
  20.  
  21.     *    Read or write to a specified port.
  22.     *    Read or write and then wait for a specified byte or word pattern
  23.     *    Read or write in byte or word modes.
  24.     *    Enter or display data in either decimal or hex.
  25.     *    Repeatedly read or write a port - generate nice scoping patterns.
  26.     *    Repeatedly read or write and alternate between a specified bit
  27.              pattern and all zeros - generates even nicer scope patterns.
  28.     *    Increment or decrement port addresses while reading or writing
  29.             a specified bit pattern.
  30.     *    Submit commands from files.
  31.  
  32.  
  33. Starting PORT
  34.  
  35. Starting PORT is easy - just type "port" on the command line.  There are
  36. 2 optional arguments that you may specify if desired.  The first argument
  37. is interpreted as the port and the second is interpreted as the bit 
  38. pattern.  These must be specified in hex with no leading modifiers, eg,
  39.  
  40.     port 3b4 0111    DON'T use 0x3b4 or any other c-like notation
  41.  
  42. You can redirect a configuration file into PORT:
  43.  
  44.     port <config
  45.  
  46. This file should contain PORT commands just as if you had typed them
  47. from the command line.  PORT will execute the commands and then
  48. wait for keyboard input.
  49.  
  50.  
  51. The Command Line
  52.  
  53. When you invoke PORT, you will see something like this:
  54.  
  55.  
  56. PORT v1.0 03/04/91 by John De Armond.  (jgd@dixie.com)
  57.  
  58. Usage: port <port_address data>  Arguments are in hex
  59.  
  60. Commands:
  61.     
  62. r           read the port
  63. w           write the port
  64. e<xd>       Enter a byte (word in designated mode, hex or decimal)
  65. m<xdbw>     Mode (x=hex, d=dec, b=byte, w=word)
  66. t n         Toggle bit <n>
  67. c           Clear all bits
  68. s           Set all bits
  69. p           Set port address
  70. g<io>       Go In or Go Out - perform action continuously
  71. i           Increment port address one count
  72. d           Decrement port address one count
  73. q           Quit
  74. <           Redirect commands from a file
  75. ?           Help
  76.  
  77. While in "go out" mode, keys 0-f will toggle bits, <t> will cause the output
  78. to alternate between the byte pattern and all zeros.
  79.  
  80. Command (help-?): 
  81.  
  82. As you enter commands, you will see a display as follows:
  83.  
  84.                                      Bits
  85.                              5432 1098 7654 3210
  86. Port:  0000    Byte:  0100,  0000 0001 0000 0000  Mode= HEX  Data= BYTE
  87.  
  88. This display shows you the currently addressed port, the current bit
  89. pattern, the mode and the data size.  The "mode" refers to the display
  90. mode and can be either decimal or hex.  The mode is changed with the
  91. "mode" command or by the use of the modifiers "x" or "d" with the
  92. (E)nter command.  See below.
  93.  
  94.  
  95. Commands:
  96.  
  97. r - read the port
  98.  
  99.     This command executes a read on the specified port.  If the data
  100.     width is set to WORD, then the LSB is written to the specified port
  101.     and the MSB is written to port+1.  If the data width is set to BYTE,
  102.     the LSB is written to the specified port and the MSB is ignored.
  103.  
  104.     If the command is followed by a hex number, the command outputs the
  105.     byte specified with the "enter" command and then reads on the 
  106.     port looking for the byte pattern specified in the command.  This is
  107.     useful when testing latching ports or when testing devices that 
  108.     return a result code on the same port.
  109.  
  110.  
  111. w - write the port
  112.  
  113.     Same as the above except that a write is executed.
  114.  
  115.  
  116. e<xd> - Enter a byte or word
  117.  
  118.     This command allows you to enter a word or byte to be written to a port.
  119.     If the command is entered with no modifier, the default entry mode
  120.     is used.  A specific mode can be specified with the options "x" for HEX
  121.     mode or "d" for DECimal mode.  Examples:
  122.  
  123.     e 0100        (assumes the default mode is HEX)
  124.     ex 0100
  125.     ed 256
  126.  
  127.     If a mode "override" is specified as above, the override sticks; ie, 
  128.     it becomes the new default mode.
  129.  
  130.  
  131. m<xdbw> - Set the mode.
  132.  
  133.     This command allows you to specify new modes with no other effects.
  134.     This command is somewhat overloaded in that it applies to the word
  135.     size in addition to the HEX or DECimal modes.  This overloading
  136.     seems logical to this humble programmer and can be learned by those
  137.     for which it is not.
  138.  
  139.  
  140. t n - Toggle bit <n>
  141.  
  142.     This command allows you to toggle the setting of any bit in a word.
  143.     "n" is the bit position starting at zero.  Thus, the MSB is 15 and
  144.     the LSB is 0.  Example:
  145.  
  146.     t 3    sets the 4th bit (3rd bit numbering from 0) in the word.
  147.  
  148.  
  149. c - Clear all bits
  150.  
  151.     This one does what it says.  It clears all bits in the I/O word.
  152.     A shortcut for "ex 0".
  153.  
  154.  
  155. s - Set all bits
  156.  
  157.     Same as above except that it sets all bits.  A shortcut for "ex ffff".
  158.  
  159.  
  160. p - Set port address
  161.  
  162.     This command enters the port address to be manipulated.  It does not
  163.     have a hex or decimal override because it is not anticipated that
  164.     this command is a high usage one and and because people think of ports
  165.     in hex and because your humble programmer got lazy :-)  The entry mode is 
  166.     automatically the default mode.  Example:
  167.  
  168.     e 3e4
  169.  
  170.     
  171. g<io> - Go In or Go Out 
  172.  
  173.     This command makes PORT continuously input or output the specified word to 
  174.     the specified port until the <enter> key is pressed. There are several
  175.     options while the "go" mode that are explained below.
  176.  
  177.  
  178. i - Increment port address one count
  179.  
  180.     Just what it says, increase the port number by one.
  181.  
  182.  
  183. d - Decrement port address one count
  184.  
  185.     Again, just what it says.
  186.  
  187.  
  188. < - Redirect commands from a file
  189.  
  190.     This command directs PORT to read the specified file and interpret the
  191.     file's contents as typed commands.  These files are useful for storing
  192.     repeated data such as port addresses and for test patterns.  One can
  193.     output to a port and then read another, for example.  When interpreting
  194.     commands from a file, PORT goes into an abbreviated message mode so that
  195.     the screen is not cluttered and so that it will run faster.
  196.  
  197.  
  198. q - Quit
  199.  
  200.     Yep, exit the program.  No twiddling is done; the program simply exits.
  201.     If you want to restore a value to a port before exiting, be sure to
  202.     explicitly do it.
  203.  
  204. ? - Help
  205.  
  206.     Displays the help screen.
  207.  
  208.  
  209. The GO mode:
  210.  
  211. The GO mode is primarily designed to generate repetitive patterns on the
  212. I/O lines so you can observe them with an oscilloscope.  When 
  213. you enter the GO mode with a "gi" or "go" command, the specified byte
  214. is repeatedly output or input to the specified port as fast as the 
  215. computer can do it.  About 200 microseconds per cycle on a 16 mhz 386
  216. and a standard printer port.  
  217.  
  218. There are several options available while in the GO mode.  They are:
  219.  
  220. <    Decrement the port address one count.
  221.  
  222. >    Increment the port address one count.
  223.  
  224. digits 0-f
  225.     Toggle the state of the specified bit.
  226.  
  227. t    Enter "toggle" mode.  Only valid for OUT mode.  In this mode, on 
  228.     alternate cycles, the specified byte is output and on the other cycle, 
  229.     the value 0 is output.  This mode generates rapid scope patterns on
  230.     the data lines.
  231.  
  232. <enter>
  233.     Leave GO mode.
  234.  
  235. Note that there is a loop counter displayed on the screen.  For speed
  236. considerations, this display is not updated unless there is a display
  237. event.  If you want to monitor the progress of the looping, simply press 
  238. the space bar which makes the screen update but with no other effect.
  239.  
  240.  
  241. Rights
  242.  
  243.     This program is copyright 1991 by John De Armond.  Minimal rights reserved.
  244.  
  245.     You may not sell this program and if you redistribute it, you must
  246.     redistribute the self-extracting ZIP file which includes the 
  247.     source.  Source must always be available.  Other than this, you 
  248.     may do with this program what you like including modifying it
  249.     and/or incorporating portions of the code in other programs.
  250.  
  251.     If you modify the program and redistribute it, please change the name
  252.     so as to avoid confusion with the real thing.
  253.  
  254.     I would appreciate your sending any modifications back to me for
  255.     inclusion in future releases.  Before you fire off with major mods,
  256.     please read the "future directions" section below and touch base with
  257.     me at the email address specified below.  As I use this program
  258.     daily, it is likely that I've already implemented some form of your
  259.     changes or at least given them some thought.  Let's swap ideas and
  260.     avoid the duplicate work.
  261.  
  262.  
  263. Future Directions:
  264.  
  265.     Here are some ideas I'm going to implement in the next releases:
  266.  
  267. *    Trapping interrupts - PORT will trap and display any hardware interrupts
  268.     it detects on specified lines.
  269.  
  270. *    Programming constructs for the command language.  To allow one to
  271.     program a test sequence with basic decision constructs.
  272.  
  273. *    A data register stack.  Allows one to store away port or byte data
  274.     for later use.
  275.  
  276. *    Command stack with recall.  Probably something similar to the Korn
  277.     shell.
  278.  
  279. *    Full screen mode.  Probably implemented on top of PC Curses to keep
  280.     the program fully freely distributable.
  281.  
  282.  
  283. Building PORT:
  284.  
  285.     PORT was written under Boreland C++ 2.0.  It uses no C++ constructs
  286.     and so should be portable to Turbo C or other DOS C compilers.
  287.     It uses the project feature of Boreland C in lieu of a makefile.
  288.     There are no special compile or link options so a makefile is not
  289.     really needed.
  290.  
  291.     The binary in the distribution is compressed with Phil Katz's 
  292.     pklite program.  Highly recommended.
  293.  
  294. Addresses:
  295.  
  296. The easiest way to get in touch with me is via Email on the Usenet.  My
  297. address is as follows:
  298.  
  299.     Domain:        jgd@dixie.com
  300.     Bang:        emory!rsiatl!jgd    or
  301.                 emory!dixie.com!jgd or (costs $$$)
  302.                 uunet!rsiatl!jgd
  303.     Slow boat:    John De Armond
  304.                 C/O Rapid Deployment Systems, Inc.
  305.                 PO Box 670386, 
  306.                 Marietta, Ga 30066
  307.     Shout:        (404) 578 9547
  308.  
  309. If you are on Compu$erv, find out how to mail through the Compu$erve <->
  310. Internet gateway.
  311.  
  312. I will NOT provide support via phone, though you may call to chat about
  313. new features or to discover ways to spend money with us.  You may also call 
  314. or write to find out about our products such as the Printer Nidget (TM), 
  315. a device that lets you hang ordinary printers from Ethernets.
  316.  
  317.  
  318. About Rapid Deployment Systems, Inc.
  319.  
  320. RDS is a company that specializes in fast solutions to tough problems involving
  321. embedded processors, TCP/IP networking and custom systems.  We have the 
  322. facilities to rapidly take an idea from concept to implementation in hardware 
  323. and/or software.  We specialize in Intel and Zilog processors.  
  324.  
  325. In addition to custom services, we have the following products under 
  326. development that will be ready for introduction in early summer 1991:
  327.  
  328. The Printer Nidget (tm)
  329.  
  330.     The Printer Nidget is the first in a series of Network Widgets.  It 
  331.     is a small modem-like box that speaks TCP/IP and allows you to attach
  332.     ordinary printers to an Ethernet network and address them from multiple
  333.     hosts.  It is designed to sit under LP (SysV) or LPR (Berkely) and
  334.     speaks FTP and RSH.  Up to 2 printers, either parallel or serial,
  335.     may be attached to the Printer Nidget.  Pseudo-commands passed to
  336.     rsh on the host specify the port to direct the print job and other 
  337.     operating parameters.  Price is expected to be under $500.
  338.  
  339. The Midget (tm)
  340.  
  341.     The Midget  (Modem Widget) is a multi-purpose modem controller that
  342.     sits between hosts and modems and does the following:
  343.  
  344.     *    Controls power to the modem based on DTR.
  345.     *    Initializes the modem on each powerup.
  346.     *    Drops idle lines after programmed intervals.
  347.     *    Breaks up getty-modem chats.
  348.     *    Provides absolute dial-out security.
  349.  
  350.     This very inexpensive device is designed to address the chronic 
  351.     problems faced by administrators when integrating so-called "smart"
  352.     modems with Unix and BBS systems.  It will also be of interest to
  353.     those who have dial-out only systems that need absolute security
  354.     against hacking when the modem is unused.  It will be available in 2, 4 
  355.     and 8 port versions.  Estimated price - $75 per port.
  356.  
  357.                               - END -
  358.  
  359.